1 using UnityEngine;
2 using
System.Collections;
3
4 public
class Scroll : MonoBehaviour {
5     
public float speed;
6     Player player;
7
8     
void Start () {
9         player = GameObject.Find(
"Player").GetComponent<Player>();
10     }
11     
12     
void Update () {
13         
float dist = player.pos * speed;
14         
if (player.pos < 0f) dist += 32f;
15         dist -= ((
int)dist / 32) * 32;
16
17         Vector3 pos = transform.position;
18         transform.position =
new Vector3(dist * -1, pos.y, pos.z);
19     }
20 }



Game đuổi chó sa mạc lập trình bằng ngôn ngữ c# 19.248 lượt xem

Gõ tìm kiếm nhanh...